package com.maykk.Demo09;

public class Judge {
    private Player player01;
    private Player player02;

    Judge() {
    }

    Judge(Player player01, Player player02) {
        this.player01 = player01;
        this.player02 = player02;
    }

    public void showGame() {
        String[] i = {"剪刀", "石头", "布"};
        System.out.printf("%s : %s --VS-- %s : %s\n",
                player01.getName(), i[player01.getRes() - 1],
                player02.getName(), i[player02.getRes() - 1]);
        if (player01.getRes() == player02.getRes()) {
            System.out.println("平局");
        } else if (
                player01.getRes() == 1 && player02.getRes() == 2 ||
                        player01.getRes() == 2 && player02.getRes() == 3 ||
                        player01.getRes() == 3 && player02.getRes() == 1
        ) {
            System.out.println(player02.getName() + "胜利");
        } else {
            System.out.println(player01.getName() + "胜利");
        }
    }

}